Skip to content

Rename ansi and prettylight colors#1352

Open
lukasoppermann wants to merge 9 commits into
mainfrom
rename/ansi-color-prettylights-syntax
Open

Rename ansi and prettylight colors#1352
lukasoppermann wants to merge 9 commits into
mainfrom
rename/ansi-color-prettylights-syntax

Conversation

@lukasoppermann
Copy link
Copy Markdown
Collaborator

@lukasoppermann lukasoppermann commented Apr 15, 2026

Summary

Drop the generic color. prefix from ANSI and prettylights syntax tokens to align with the domain-specific naming convention used elsewhere (bgColor, fgColor, borderColor, display). All token values are preserved exactly — only names change.

List of notable changes:

  • renamed color.ansi.*ansi.* (e.g. --color-ansi-red--ansi-red)
  • renamed color.prettylights.syntax.*prettylights.syntax.* (e.g. --color-prettylights-syntax-keyword--prettylights-syntax-keyword)
  • renamed kebab/dotted canonical leaf tokens to camelCase (e.g. entity-tagentityTag, storage.modifier.importstorageModifierImport)
  • deprecated all old color.ansi.* and color.prettylights.syntax.* tokens as backward-compatible aliases referencing the new canonical names
  • fixed prettylights.syntax.entityTag was accidentally assigned entity's purple values instead of the original entity-tag blue+tritanopia values — corrected to match the original token values
  • fixed prettylights.syntax.entity was incorrectly made a deprecated alias; restored as a canonical token with the original purple values ({base.color.purple.6}, dark {base.color.purple.2})
  • added $description to all 47 individual tokens (17 ANSI + 30 prettylights)
  • updated contributor-docs/agents/token-authoring.md with naming conventions table, deprecation/rename guide, and deprecated prefix notes

Backward compatibility

Old tokens are kept as deprecated aliases using var() references:

--color-ansi-red: var(--ansi-red);
--color-prettylights-syntax-keyword: var(--prettylights-syntax-keyword);

What should reviewers focus on?

  • Confirm no token values have changed — only names and structure
  • Confirm deprecated aliases correctly resolve to the new canonical tokens
  • Confirm prettylights.syntax.entity (purple) and prettylights.syntax.entityTag (blue, HTML/XML tags) have distinct, correct values

Steps to test:

  1. Run npm run lint — should pass with no warnings
  2. Run npm run format — should pass with no changes
  3. Run npm test — all 9 tests should pass
  4. Run npm run build — verify new CSS vars are emitted with resolved values and old CSS vars are emitted as var(--new-name) references

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change
  • Verify the design tokens changed in this PR are expected using the diffing results in this PR

…lights.syntax.*

Drop the generic 'color.' prefix from ANSI and prettylights syntax tokens
to align with domain-specific naming (bgColor, fgColor, borderColor, display).

New CSS vars: --ansi-red, --prettylights-syntax-keyword
Old CSS vars kept as deprecated aliases: --color-ansi-red: var(--ansi-red)

- Add $description to all 47 individual tokens
- Add deprecated aliases with $deprecated field for migration
- Update token-authoring.md with naming conventions and deprecation guide

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lukasoppermann lukasoppermann requested a review from a team as a code owner April 15, 2026 10:31
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: f1cfc4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/primitives Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

Design Token Diff (CSS)

The message is too long to be displayed here. For more details, please check the job summary.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

Design Token Diff (StyleLint)

The message is too long to be displayed here. For more details, please check the job summary.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

Design Token Diff (Figma)

The message is too long to be displayed here. For more details, please check the job summary.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates functional syntax color token naming by promoting ansi.* and prettylights.syntax.* to first-class (non-color.*) token groups, while retaining the previous color.ansi.* and color.prettylights.syntax.* names as deprecated aliases for backward compatibility.

Changes:

  • Renames token paths from color.ansi.*ansi.* and color.prettylights.syntax.*prettylights.syntax.*.
  • Adds deprecated alias tokens that reference the new canonical tokens via {...} references (and marks them with $deprecated + “Deprecated. Use … instead.” descriptions).
  • Updates token authoring documentation with guidance for renames/deprecations and naming conventions.
Show a summary per file
File Description
src/tokens/functional/color/syntax.json5 Introduces new canonical ansi.* and prettylights.syntax.* token groups and adds deprecated color.* aliases.
contributor-docs/agents/token-authoring.md Documents conventions for renaming/deprecating tokens and the expected naming patterns.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (2)

src/tokens/functional/color/syntax.json5:396

  • prettylights.syntax.entity-tag changes the dark override from {base.color.neutral.8} to {base.color.green.1} and adds additional color-vision overrides. This is a functional palette change beyond the rename/deprecation work; please confirm it's intentional (and document it) or keep the previous override values to avoid unexpected visual diffs.
            dark: '{base.color.green.1}',
            'dark-tritanopia': '{base.color.blue.1}',
            'dark-tritanopia-high-contrast': '{base.color.blue.1}',
            'dark-protanopia-deuteranopia': '{base.color.blue.1}',
            'dark-protanopia-deuteranopia-high-contrast': '{base.color.blue.1}',

src/tokens/functional/color/syntax.json5:562

  • prettylights.syntax['string-regexp'] modifies several overrides (e.g. dark from {base.color.green.3} to {base.color.green.1}, and the tritanopia/protanopia mappings from *.3 to *.1). If this PR’s scope is limited to renames + deprecated aliases, consider reverting these value changes (or explicitly documenting them) to avoid unexpected syntax highlighting changes across themes.
            dark: '{base.color.green.1}',
            'dark-tritanopia': '{base.color.blue.1}',
            'dark-tritanopia-high-contrast': '{base.color.blue.1}',
            'light-tritanopia': '{base.color.blue.6}',
            'light-tritanopia-high-contrast': '{base.color.blue.6}',
            'dark-protanopia-deuteranopia': '{base.color.blue.1}',
            'dark-protanopia-deuteranopia-high-contrast': '{base.color.blue.1}',
  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines 317 to 319
'org.primer.overrides': {
dark: '{base.color.neutral.6}',
dark: '{base.color.neutral.9}',
},
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there should be no token value changes, just the names schange. Fix this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot No, there should be no token value changes, just the names schange. Fix this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f1cfc4a. The root cause was that prettylights.syntax.entityTag was accidentally created using prettylights.syntax.entity's purple values ({base.color.purple.6}, dark {base.color.purple.2}) instead of the original entity-tag values ({base.color.blue.6}, dark {base.color.green.1} + tritanopia overrides). Additionally, prettylights.syntax.entity was incorrectly turned into a deprecated alias pointing to entityTag, losing its canonical purple values.

The fix:

  • prettylights.syntax.entityTag now correctly uses the original entity-tag values (blue + green dark + tritanopia)
  • prettylights.syntax.entity is restored as a proper canonical token with the original entity purple values

All other canonical camelCase tokens (constantOtherReferenceLink, storageModifierImport, etc.) were verified to have correct values matching the originals.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/tokens/functional/color/syntax.json5
Copilot AI changed the title Rename color.ansi.* → ansi.* and color.prettylights.syntax.* → prettylights.syntax.* Fix the failing GitHub Actions job "Test & Lint" May 12, 2026
Copilot AI temporarily deployed to github-pages May 12, 2026 07:52 Inactive
@github-actions github-actions Bot temporarily deployed to Preview (Storybook) May 12, 2026 07:53 Inactive
@lukasoppermann lukasoppermann changed the title Fix the failing GitHub Actions job "Test & Lint" Rename ansi and prettylight colors May 12, 2026
Migrate prettylights syntax tokens to new naming while maintaining legacy support.
@github-actions github-actions Bot temporarily deployed to Preview (Storybook) May 12, 2026 09:08 Inactive
@lukasoppermann lukasoppermann added update snapshots Update visual regression test snapshots and removed update snapshots Update visual regression test snapshots labels May 12, 2026
@github-actions github-actions Bot removed the update snapshots Update visual regression test snapshots label May 12, 2026
@primer primer Bot temporarily deployed to github-pages May 12, 2026 10:40 Inactive
@github-actions github-actions Bot temporarily deployed to Preview (Storybook) May 12, 2026 10:40 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants